//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the HiSi end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
//  Copyright (c) 2007. Hisilicon Technologies, CO., LTD. All Rights Reserved
//  THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
//  BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
//  HISILICON TECHNOLOGIES, CO., LTD.
//
//------------------------------------------------------------------------------
//
//  File:  gpio.h
//
//  Defines the GPIO interrupt function.
//
//------------------------------------------------------------------------------
//
//  revision:
//  
//------------------------------------------------------------------------------

#ifndef __GPIO_H__
#define __GPIO_H__

//-----------------------------------------------------------------------------
//
// Function:  BSPGetGpioBaseAddr
//
// This function get GPIO group address.
//
UINT32 BSPGetGpioBaseAddr (UINT8 ucId);
//-----------------------------------------------------------------------------
//
// Function:  BSPGpioIntrInit
//
// This function initialize the GPIO interrupt.
BOOL BSPGpioIntrInit();

//------------------------------------------------------------------------------
//
// Function:  BSPGpioIntrEnableIrq
//
// This function is called from OALIntrEnableIrq to enable interrupt on
// GPIO interrupt controller.
//
UINT32 BSPGpioIntrEnableIrq(UINT32 irq);

//------------------------------------------------------------------------------
//
// Function:  BSPGpioIntrDisableIrq
//
// This function is called from OALIntrDisableIrq to disable interrupt on
// GPIO interrupt controller.
//
UINT32 BSPGpioIntrDisableIrq(UINT32 irq);

//------------------------------------------------------------------------------
//
// Function:  BSPIntrDoneIrq
//
// This function is called from OALIntrDoneIrq to finish interrupt on
// GPIO interrupt controller.
//
UINT32 BSPGpioIntrDoneIrq(UINT32 irq);

//------------------------------------------------------------------------------
//
// Function:  GetIntrIrq
//
// This function check GPIO masked interrupt status. return the first irq interrupt.
//
UINT32 GetBitPosition(UINT32 gpioStateIrq);

//------------------------------------------------------------------------------
//
//  Function:  BSPGpioIntrActiveIrq
//
//  This function is called from interrupt handler to give BSP chance to 
//  translate IRQ in case of GPIO interrupt controller.
//
UINT32 BSPGpioIntrActiveIrq(UINT32 irq);

#endif
